Repository navigation
Conversation
The sessions extension resolves php.ini through PHPConfigHelper, which builds its paths from ctx.BuildDir. That field is populated in NewContext from a BUILD_DIR environment variable that the lifecycle never exports, so it is empty and the helper opens the relative path php/etc/php.ini. Any app with a bound Redis or Memcached session service therefore fails staging with: Extension compilation failed: extension sessions compile failed: failed to load PHP config: failed to load php.ini: failed to read config file php/etc/php.ini The supply phase records the real location under the DEPS_DIR key, and that is also where PHP is installed: php.ini lives in <deps>/<idx>/php/etc, never under the build directory. The unit test passed only because it assigned ctx.BuildDir directly, bypassing the code path production uses, and laid out php/etc under the build directory. It now models the dependency directory instead.
|
|
|
Asked my AI to review this PR What the change does
Verification of the fix
Conclusion: the fix is correct and minimal. Findings[LOW]
[LOW]
[LOW]
[LOW] Branch base
Follow-up check: composer and New RelicThe original review raised a MEDIUM finding that
|
|
So I would say there is nothing blocking it from getting merged |
Staging fails for any app with a bound Redis or Memcached session service:
This is the failure reported in #1291.
Cause
NewPHPConfigHelperbuilds its paths fromctx.BuildDir:NewContextfills that field fromos.Getenv("BUILD_DIR"), which the lifecycle never exports, so it is empty and the helper opens the relative pathphp/etc/php.ini.createExtensionContextdoes callctx.Set("BUILD_DIR", s.Stager.BuildDir()), butSetwrites into theDatamap and does not reach the struct field. Every other extension readsctx.GetString("BUILD_DIR")and is unaffected, which is why only the sessions path breaks.The build directory is also the wrong base.
installPHPusesfilepath.Join(s.Stager.DepDir(), "php"), andphp.iniis written to<deps>/<idx>/php/etc/php.ini. Nothing writes to<build>/php.Fix
Resolve
php.iniandphp-fpm.conffromctx.GetString("DEPS_DIR"), which the supply phase sets tos.Stager.DepDir().Test
sessions_test.gopassed only because it assignedctx.BuildDirdirectly, with a comment noting thatSet()would not work, and createdphp/etcunder the build directory. That layout does not exist at staging time, so the test could not catch this. It now models the dependency directory. All unit tests pass;src/php/bratsfails identically before and after this change, on aDeferCleanupmisuse in the vendoredbratshelper.